using System;
using System.Globalization;

namespace VSSDKAssist.Platform.Helpers
{
	/// <summary>
	/// Argument validation helper class
	/// </summary>
	public static class Guard
	{
		/// <summary>
		/// Arguments the not null.
		/// </summary>
		/// <param name="argumentValue">The argument value.</param>
		/// <param name="argumentName">Name of the argument.</param>
		public static void ArgumentNotNull(object argumentValue, string argumentName)
		{
			if(argumentValue == null)
			{
				throw new ArgumentNullException(argumentName);
			}
		}

		/// <summary>
		/// Arguments the not null or empty string.
		/// </summary>
		/// <param name="argumentValue">The argument value.</param>
		/// <param name="argumentName">Name of the argument.</param>
		[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods")]
		public static void ArgumentNotNullOrEmptyString(string argumentValue, string argumentName)
		{
			ArgumentNotNull(argumentValue, argumentName);
			if(argumentValue.Length == 0)
			{
				throw new ArgumentException(
					string.Format(
						CultureInfo.CurrentCulture, 
						Properties.Resources.StringCannotBeEmpty, 
						new object[] { argumentName }));
			}
		}
	}
}